package com.hpeu_01.day0112.homework;

public class Computer {
    public void run(String s) throws MaoYanException, LanPinException, NoPlanException {
        if (s=="电脑冒烟"){
            throw new MaoYanException("NoPlanException:讲课进度无法继续,电脑冒烟了");
        }else if(s=="电脑蓝屏"){
            throw new LanPinException("讲课进度无法继续,电脑蓝屏了");
        }else if (s=="讲师的问题"){
            throw new NoPlanException("课时计划无法完成");
        }
    }
}
//电脑蓝屏异常
class LanPinException extends Exception{

    private static final long serialVersionUID = 8563777345253977983L;
    private String message;

    @Override
    public String getMessage() {
        return message;
    }

    public LanPinException(String message) {
        this.message = message;
    }

    public LanPinException() {
    }

}
//冒烟异常
class MaoYanException extends Exception{

    private static final long serialVersionUID = -244397119367568031L;

    private String message;

    @Override
    public String getMessage() {
        return message;
    }

    public MaoYanException(String message) {
        this.message = message;
    }

    public MaoYanException() {
    }

}
//不能继续讲课异常
class NoPlanException extends Exception{

    private static final long serialVersionUID = 207680774307404245L;
    private String message;

    @Override
    public String getMessage() {
        return message;
    }

    public NoPlanException(String message) {
        this.message = message;
    }
}
class ComputerDemo{
    public static void main(String[] args) {
        Computer computer = new Computer();
        try {
            computer.run("电脑冒烟");
        } catch (MaoYanException e) {
            System.out.println(e.getMessage());
        } catch (LanPinException e) {
            System.out.println(e.getMessage());
        } catch (NoPlanException e) {
            System.out.println(e.getMessage());
        }
    }
}